<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head th:replace="common/layout :: common_header(~{::title},~{::link})">
<title>添加短信模板</title>
</head>
<body>
	<div class="main-container">
		<div class="main-content-inner">
			<div class="page-content">
				<form class="form-horizontal" role="form" id="userAddForm"
					method="post" th:action="@{/sms/smsTemplate/save}">
					<table
						class="table table-bordered  table-condensed dataTables-example dataTable no-footer">

						<tbody>
							<tr>
								<td class="width-15 active"><label
									class="pull-right  control-label" for="ds_name">模板名称</label></td>
								<td class="width-75"><input class="form-control"
									id="ds_name" name="name" type="text" placeholder="" required></td>
							</tr>

							<tr>
								<td class="width-15 active"><label
									class="pull-right  control-label" for="ds_code">模板编码</label></td>
								<td class="width-75"><input class="form-control"
									id="ds_code" name="code" type="text" placeholder="" required></td>
							</tr>

							<tr>
								<td class="width-15 active"><label
									class="pull-right  control-label" for="ds_detail">阿里云模板编码</label></td>
								<td class="width-75"><input class="form-control"
									id="ds_detail" name="content" type="text" placeholder=""
									required></td>
							</tr>
							<tr>
								<td class="width-15 active"><label
									class="pull-right  control-label" for="ds_detail">模板内容</label></td>
								<td class="width-75"><textarea class="form-control"
										id="ds_note" name="note"></textarea></td>
							</tr>
						</tbody>
					</table>
					<div class="clearfix ">
						<div class="center">
							<button class="btn btn-info" type="submit" id="submitBtn">
								<i class="ace-icon fa fa-check bigger-110"></i> 保存
							</button>

							&nbsp; &nbsp; &nbsp;
							<button class="btn" type="button" id="closeWin">
								<i class="ace-icon fa fa-del bigger-110"></i> 关闭
							</button>
						</div>
					</div>

				</form>
				<!-- /.col -->
			</div>

		</div>
		<!-- end main container -->
	</div>

	<div th:replace="common/commonJS"></div>

	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		//关闭iframe
		$('#closeWin').click(function(){
		    top.layer.close(index);
		});
	
		$().ready(function() {
			
			$("#userAddForm").validate({
				submitHandler : function(form) {
					//验证通过后 的js代码写在这里 
					$(form).ajaxSubmit({
						dataType : "json",
						success : function(data) {
							if (data.code == 0) {
								top.layer.alert('保存成功')
								top.layer.close(index);
								top.getActiveTab()[0].contentWindow.search();
							} else {
								top.layer.alert('保存失败')
							}

						},
						error : function(xhr, status, error) {
							top.layer.alert('操作失败');
						}
					});

				}
			});
		});
	</script>
</body>
</html>